package com.example.muasic.activity;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;

import com.example.muasic.R;
import com.example.muasic.service.MusicService;
import com.mob.MobSDK;
import com.mob.ums.OperationCallback;
import com.mob.ums.User;
import com.mob.ums.gui.UMSGUI;

import java.util.HashMap;


public class music_login extends AppCompatActivity {

    private SharedPreferences preferences;
    private SharedPreferences.Editor editor;
    private EditText UserName;
    private EditText Password;
    private CheckBox IsRemember;
    private Button bu_login;
    private Button bu_register;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_music_login);

//        preferences = getSharedPreferences("user_data", Context.MODE_PRIVATE);
//        editor = preferences.edit();
//        UserName = (EditText) findViewById(R.id.username_edit);
//        Password = (EditText) findViewById(R.id.password_edit);
//        IsRemember = (CheckBox) findViewById(R.id.remember);
//        bu_login =(Button) findViewById(R.id.login);
//        bu_login.setOnClickListener(this);
//        bu_register = (Button)findViewById(R.id.register);
//        bu_register.setOnClickListener(this);
//
//        CheckRemember(preferences);
    }


//    private void CheckRemember(SharedPreferences sharedPreferences){
//        IsRemember.setChecked(true);
//        UserName.setText(sharedPreferences.getString("username",""));
//        Password.setText(sharedPreferences.getString("password",""));
//
//    }
//
//    private void login(){
//        String mUserName = UserName.getText().toString();
//        String mPassword = Password.getText().toString();
//
//        String user_name = preferences.getString("username","");
//        String pass_word = preferences.getString("password","");
//
//        if(mUserName.equals(user_name)&&mPassword.equals(pass_word)){
//            Toast.makeText(this,"登录成功",Toast.LENGTH_SHORT).show();
//
//            Intent intent = new Intent(music_login.this,MainActivity.class);
//            this.startActivity(intent);
//        }else{
//            Toast.makeText(this,"登录失败",Toast.LENGTH_SHORT).show();
//        }
//    }
//
//    @Override
//    public void onClick(View v) {
//        switch (v.getId()){
//            case R.id.register:
//                Register_Put(UserName.getText().toString(),Password.getText().toString());
//                Toast.makeText(this,"success",Toast.LENGTH_SHORT).show();
//                break;
//            case R.id.login:
//                login();
//                break;
//        }
//    }
//
//    public void Register_Put(String username,String password){
//
//        editor.putString("username",username);
//        editor.putString("password",password);
//        editor.commit();
//    }
}
